/**
 * Copyright [2019] [LiBo/Alex of copyright liboware@gmail.com ]
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.monitor.profile.model;

import com.hyts.monitor.profile.config.ProfilerConfig;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.text.DateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @project-name:coffice-toolbox
 * @package-name:com.hyts.monitor.profile.model
 * @author:LiBo/Alex
 * @create-date:2019-08-06 16:36
 * @copyright:libo-alex4java
 * @email:liboware@gmail.com
 * @description:
 */
@ToString
@Data
@Accessors(chain = true)
public class Attribute {

    private AtomicBoolean useNanoChannel = new AtomicBoolean(ProfilerConfig.AttributeConfig.USE_NANO_LEVEL);

    private AtomicBoolean ignoreSetterAndGetter = new AtomicBoolean(ProfilerConfig.AttributeConfig.INGNORE_GETTER_SETTER);

    private String logPath = ProfilerConfig.FileConfig.DEFAULT_LOGIN_FULL_PATH;

    private String logName = ProfilerConfig.AttributeConfig.DEFAULT_PROFILER_LOG_NAME_PREFIX+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));

    private String configPath = ProfilerConfig.FileConfig.DEFAULT_CONFIG_PATH_02;

    /**
     * 是否启动时间规则执行要求-必须等于触发时间才可以执行
     * 当前时间必须为触发时间的时候才可以执行，否则不profiler
     * true：固定化时间规范profiler
     * false: 非固定化，只要在介于start and end时间之间都会执行profiler - 默认
     */
    @Deprecated
    @Getter
    @Setter
    private AtomicBoolean timeFixExecution = new AtomicBoolean(ProfilerConfig.AttributeConfig.DEFAULT_TIME_FIX_MODEL);

    /**
     * 是否支持远程操作-建立socket服务进行交互
     */
    @Getter
    @Setter
    private AtomicBoolean openRemoteAccess = new AtomicBoolean(ProfilerConfig.AttributeConfig.DEFAULT_OPEN_ACCESS_REMOTE);

    /**
     * 是否进行profile 采集工作功能实现
     * 根绝相关策略-生成目前服务运作状态
     * 是否处于运行状态的标志
     */
    @Setter
    @Getter
    private AtomicBoolean working = new AtomicBoolean(false);

    /**
     * 是否进行debug模式操作
     */
    @Getter
    @Setter
    private AtomicBoolean debugModel = new AtomicBoolean(ProfilerConfig.AttributeConfig.DEFAULT_DEBUG_MODEL);

    /**
     * 当前时间是否超过当天的结束时间
     * 此状态为 可能为非实时操作
     * 被维护的服务：
     * 1.初始化服务会初始化
     * 2.时间控制处理器会做定时更新-从而管理是否进行相关的working状态
     */
    @Getter
    private AtomicBoolean currentMoreThanEndTime = new AtomicBoolean(false);
}
